﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace MyVideoViewerManager
{
    /// <summary>
    /// Interaction logic for StatusControl.xaml
    /// </summary>
    public partial class StatusControl : UserControl
    {
        
        public StatusControl()
        {
            InitializeComponent();
        }       
        public void SetDisplay(bool display)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                if (display)
                {
                    StatusProgressBar.IsIndeterminate = true;
                    rootLayout.Visibility = Visibility.Visible;
                }
                else
                {
                    rootLayout.Visibility = Visibility.Collapsed;
                }
            });
        }
        public void Update(string statusText, bool isIndeterminate, double progressBarValue)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                statusTextBlock.Text = statusText;
                StatusProgressBar.IsIndeterminate = isIndeterminate;
                StatusProgressBar.Value = progressBarValue;
            });
        }
        public void Update(string statusText)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                statusTextBlock.Text = statusText;
            });
        }
        public void Update(double progressBarValue)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                StatusProgressBar.Value = progressBarValue;
            });
        }
        public void Update(bool isIndeterminate)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
            {
                StatusProgressBar.IsIndeterminate = isIndeterminate;
            });
        }
    }
}
